package me.ydq.core.sql;

import me.ydq.core.SqlSpec;
import me.ydq.misc.Fn;

import java.util.function.Supplier;

public interface SqlIsNotNull<T> {

    SqlSpec<T> isNotNull(Fn<T, ?> fn);

    SqlSpec<T> isNotNull(String column);

    default SqlSpec<T> isNotNull(Supplier<Boolean> condition, Fn<T, ?> fn) {
        return condition.get() ? isNotNull(fn) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> isNotNull(boolean condition, Fn<T, ?> fn) {
        return condition ? isNotNull(fn) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> isNotNull(Supplier<Boolean> condition, String rawColumn) {
        return condition.get() ? isNotNull(rawColumn) : (SqlSpec<T>) this;
    }

    default SqlSpec<T> isNotNull(boolean condition, String rawColumn) {
        return condition ? isNotNull(rawColumn) : (SqlSpec<T>) this;
    }

}
